<?php

namespace app\modules\user\forms\order;

use app\common\forms\BaseForm;

class OrderForm extends BaseForm{

    public $user_id;
    public $order_no;
    public $merchant_id;
    public $goods_item;
    public $delivery_time;
    public $payment;
    public $name;
    public $mobile;
    public $address;
    public $lng_lat;
    public $remark='';

    public function rules()
    {
        return [
            ['user_id','default','value'=>\Yii::$app->getModule("user")->get("user")->getId()],
            ['order_no','default','value'=>date("YmdHis").random_int(1000,9999)],
            ['merchant_id','required','message'=>\Yii::t("app","商户ID不能为空")],
            ['goods_item','required','message'=>\Yii::t("app","商品信息不能为空")],
            ['delivery_time','required','message'=>\Yii::t("app","送达时间不能为空")],
            ['payment','integer','skipOnEmpty'=>false,'message'=>\Yii::t("app","支付方式错误")],
            ['name','required','message'=>\Yii::t("app","联系人姓名不能为空")],
            ['mobile','required','message'=>\Yii::t("app","联系号码不能为空")],
            ['address','required','message'=>\Yii::t("app","地址不能为空")],
            ['lng_lat','required','message'=>\Yii::t("app","坐标信息不能为空")],
            ['remark','safe'],
        ];
    }
}